package com.wanmait.translate.system.controller;

import com.wanmait.translate.dto.ListToDo;
import com.wanmait.translate.dto.audit.AuditContentInterface;
import com.wanmait.translate.system.service.impl.AuditedServiceImpl;
import com.wanmait.translate.utils.AuditEnum;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @Author huweibin
 * @Description 个人任务的控制器
 * @Date 11:13 2020/11/23
 **/
@RestController
@CrossOrigin
@RequestMapping("/index")
public class IndexController {

    @Resource
    private AuditedServiceImpl auditedService;
    /*
     * @Author huweibin
     * @Description 获得最近的待办数
     * @Date 11:15 2020/11/23
     **/

    @RequestMapping("/listToDo")
    public    Map<String, List<ListToDo.ReturnState>> listToDo(String date){
        //这里有权限判断，看他有哪些审核的权限
        //模拟他只有出差审核的权限
        List<AuditEnum> auditEnums = Arrays.asList(AuditEnum.TRAVELED_AUDIT);
        return  auditedService.listToDo(auditEnums, date).getCountSateSortResult();
    }
    /**
     * @Author huweibin
     * @Description 获得一天的详细
     * @Date 19:56 2020/11/24
     **/
    @RequestMapping("/listOneDayToDo")
    public  Map<String, List<AuditContentInterface>> listOneDayToDo(String date){
        //这里有权限判断，看他有哪些审核的权限
        //模拟他只有出差审核的权限
        List<AuditEnum> auditEnums = Arrays.asList(AuditEnum.TRAVELED_AUDIT);
        return  auditedService.listOneDayToDo(auditEnums,date).getListTimeSortResult();
    }
}
